// 【other 其他】
const j = require('../../src/lib/other')

describe('valiPasswordStrong 验证密码强度', () => {
  test('1564677900 密码强度', () => {
    let res = j.valiPasswordStrong('1564677900')
    expect(res.strong).toBe(10)
  })
})

describe('specCartesian 笛卡尔数据积', () => {
  test('商品 SUP 供货', () => {
    let list = [['红色', '黑色', '白色'], ['m码', 'x码'], ['T恤']]
    let res = j.specCartesian(list)
    expect(res).toHaveLength(6)
  })
})

describe('deepCloneObj 对象深拷贝【中级版】', () => {
  test('空', () => {
    let res = j.deepCloneObj('')
    expect(res).toBe(null)
  })
  test('拷贝对象', () => {
    let obj = { name: 'tom', data: { key: 'a', value: 1 } }
    let objCopy = j.deepCloneObj(obj)
    objCopy.data = null
    expect(obj.name).toBe('tom')
    expect(obj.data.value).toBe(1)
  })
})

describe('toChinesNum 阿拉伯数字转中文数字', () => {
  test('0', () => {
    let res = j.toChinesNum(0)
    expect(res).toBe('零')
  })
  test('10010 边界测试1', () => {
    let res = j.toChinesNum(10010)
    expect(res).toBe('一万零十')
  })
  test('1001001 边界测试2', () => {
    let res = j.toChinesNum(1001001)
    expect(res).toBe('一百万一千零一')
  })
  test('123 普通数字', () => {
    let res = j.toChinesNum(123)
    expect(res).toBe('一百二十三')
  })
})
